3.1212 \(\int \frac{a+b \tan (e+f x)}{c+d \tan (e+f x)} \, dx\)

Optimal. Leaf size=59 \[ \frac{x (a c+b d)}{c^2+d^2}-\frac{(b c-a d) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right )} \]

[Out]

((a*c + b*d)*x)/(c^2 + d^2) - ((b*c - a*d)*Log[c*Cos[e + f*x] + d*Sin[e + f*x]])/((c^2 + d^2)*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0716156, antiderivative size = 59, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.087, Rules used = {3531, 3530} \[ \frac{x (a c+b d)}{c^2+d^2}-\frac{(b c-a d) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right )} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Tan[e + f*x])/(c + d*Tan[e + f*x]),x]

[Out]

((a*c + b*d)*x)/(c^2 + d^2) - ((b*c - a*d)*Log[c*Cos[e + f*x] + d*Sin[e + f*x]])/((c^2 + d^2)*f)

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3530

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c*Log[Re
moveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]])/(b*f), x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rubi steps

\begin{align*} \int \frac{a+b \tan (e+f x)}{c+d \tan (e+f x)} \, dx &=\frac{(a c+b d) x}{c^2+d^2}-\frac{(b c-a d) \int \frac{d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{c^2+d^2}\\ &=\frac{(a c+b d) x}{c^2+d^2}-\frac{(b c-a d) \log (c \cos (e+f x)+d \sin (e+f x))}{\left (c^2+d^2\right ) f}\\ \end{align*}

Mathematica [A]  time = 0.101614, size = 65, normalized size = 1.1 \[ \frac{2 (a c+b d) \tan ^{-1}(\tan (e+f x))+(b c-a d) \left (\log \left (\sec ^2(e+f x)\right )-2 \log (c+d \tan (e+f x))\right )}{2 f \left (c^2+d^2\right )} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Tan[e + f*x])/(c + d*Tan[e + f*x]),x]

[Out]

(2*(a*c + b*d)*ArcTan[Tan[e + f*x]] + (b*c - a*d)*(Log[Sec[e + f*x]^2] - 2*Log[c + d*Tan[e + f*x]]))/(2*(c^2 +
 d^2)*f)

________________________________________________________________________________________

Maple [B]  time = 0.023, size = 153, normalized size = 2.6 \begin{align*} -{\frac{a\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) d}{2\,f \left ({c}^{2}+{d}^{2} \right ) }}+{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) bc}{2\,f \left ({c}^{2}+{d}^{2} \right ) }}+{\frac{a\arctan \left ( \tan \left ( fx+e \right ) \right ) c}{f \left ({c}^{2}+{d}^{2} \right ) }}+{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) bd}{f \left ({c}^{2}+{d}^{2} \right ) }}+{\frac{a\ln \left ( c+d\tan \left ( fx+e \right ) \right ) d}{f \left ({c}^{2}+{d}^{2} \right ) }}-{\frac{\ln \left ( c+d\tan \left ( fx+e \right ) \right ) bc}{f \left ({c}^{2}+{d}^{2} \right ) }} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tan(f*x+e))/(c+d*tan(f*x+e)),x)

[Out]

-1/2/f*a/(c^2+d^2)*ln(1+tan(f*x+e)^2)*d+1/2/f/(c^2+d^2)*ln(1+tan(f*x+e)^2)*b*c+1/f*a/(c^2+d^2)*arctan(tan(f*x+
e))*c+1/f/(c^2+d^2)*arctan(tan(f*x+e))*b*d+1/f*a/(c^2+d^2)*ln(c+d*tan(f*x+e))*d-1/f/(c^2+d^2)*ln(c+d*tan(f*x+e
))*b*c

________________________________________________________________________________________

Maxima [A]  time = 1.61527, size = 119, normalized size = 2.02 \begin{align*} \frac{\frac{2 \,{\left (a c + b d\right )}{\left (f x + e\right )}}{c^{2} + d^{2}} - \frac{2 \,{\left (b c - a d\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{2} + d^{2}} + \frac{{\left (b c - a d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))/(c+d*tan(f*x+e)),x, algorithm="maxima")

[Out]

1/2*(2*(a*c + b*d)*(f*x + e)/(c^2 + d^2) - 2*(b*c - a*d)*log(d*tan(f*x + e) + c)/(c^2 + d^2) + (b*c - a*d)*log
(tan(f*x + e)^2 + 1)/(c^2 + d^2))/f

________________________________________________________________________________________

Fricas [A]  time = 1.46113, size = 174, normalized size = 2.95 \begin{align*} \frac{2 \,{\left (a c + b d\right )} f x -{\left (b c - a d\right )} \log \left (\frac{d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right )}{2 \,{\left (c^{2} + d^{2}\right )} f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))/(c+d*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/2*(2*(a*c + b*d)*f*x - (b*c - a*d)*log((d^2*tan(f*x + e)^2 + 2*c*d*tan(f*x + e) + c^2)/(tan(f*x + e)^2 + 1))
)/((c^2 + d^2)*f)

________________________________________________________________________________________

Sympy [A]  time = 2.56681, size = 524, normalized size = 8.88 \begin{align*} \begin{cases} \frac{\tilde{\infty } x \left (a + b \tan{\left (e \right )}\right )}{\tan{\left (e \right )}} & \text{for}\: c = 0 \wedge d = 0 \wedge f = 0 \\\frac{a x + \frac{b \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f}}{c} & \text{for}\: d = 0 \\- \frac{i a f x \tan{\left (e + f x \right )}}{- 2 d f \tan{\left (e + f x \right )} + 2 i d f} - \frac{a f x}{- 2 d f \tan{\left (e + f x \right )} + 2 i d f} - \frac{i a}{- 2 d f \tan{\left (e + f x \right )} + 2 i d f} - \frac{b f x \tan{\left (e + f x \right )}}{- 2 d f \tan{\left (e + f x \right )} + 2 i d f} + \frac{i b f x}{- 2 d f \tan{\left (e + f x \right )} + 2 i d f} + \frac{b}{- 2 d f \tan{\left (e + f x \right )} + 2 i d f} & \text{for}\: c = - i d \\- \frac{i a f x \tan{\left (e + f x \right )}}{2 d f \tan{\left (e + f x \right )} + 2 i d f} + \frac{a f x}{2 d f \tan{\left (e + f x \right )} + 2 i d f} - \frac{i a}{2 d f \tan{\left (e + f x \right )} + 2 i d f} + \frac{b f x \tan{\left (e + f x \right )}}{2 d f \tan{\left (e + f x \right )} + 2 i d f} + \frac{i b f x}{2 d f \tan{\left (e + f x \right )} + 2 i d f} - \frac{b}{2 d f \tan{\left (e + f x \right )} + 2 i d f} & \text{for}\: c = i d \\\frac{x \left (a + b \tan{\left (e \right )}\right )}{c + d \tan{\left (e \right )}} & \text{for}\: f = 0 \\\frac{2 a c f x}{2 c^{2} f + 2 d^{2} f} + \frac{2 a d \log{\left (\frac{c}{d} + \tan{\left (e + f x \right )} \right )}}{2 c^{2} f + 2 d^{2} f} - \frac{a d \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 c^{2} f + 2 d^{2} f} - \frac{2 b c \log{\left (\frac{c}{d} + \tan{\left (e + f x \right )} \right )}}{2 c^{2} f + 2 d^{2} f} + \frac{b c \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 c^{2} f + 2 d^{2} f} + \frac{2 b d f x}{2 c^{2} f + 2 d^{2} f} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))/(c+d*tan(f*x+e)),x)

[Out]

Piecewise((zoo*x*(a + b*tan(e))/tan(e), Eq(c, 0) & Eq(d, 0) & Eq(f, 0)), ((a*x + b*log(tan(e + f*x)**2 + 1)/(2
*f))/c, Eq(d, 0)), (-I*a*f*x*tan(e + f*x)/(-2*d*f*tan(e + f*x) + 2*I*d*f) - a*f*x/(-2*d*f*tan(e + f*x) + 2*I*d
*f) - I*a/(-2*d*f*tan(e + f*x) + 2*I*d*f) - b*f*x*tan(e + f*x)/(-2*d*f*tan(e + f*x) + 2*I*d*f) + I*b*f*x/(-2*d
*f*tan(e + f*x) + 2*I*d*f) + b/(-2*d*f*tan(e + f*x) + 2*I*d*f), Eq(c, -I*d)), (-I*a*f*x*tan(e + f*x)/(2*d*f*ta
n(e + f*x) + 2*I*d*f) + a*f*x/(2*d*f*tan(e + f*x) + 2*I*d*f) - I*a/(2*d*f*tan(e + f*x) + 2*I*d*f) + b*f*x*tan(
e + f*x)/(2*d*f*tan(e + f*x) + 2*I*d*f) + I*b*f*x/(2*d*f*tan(e + f*x) + 2*I*d*f) - b/(2*d*f*tan(e + f*x) + 2*I
*d*f), Eq(c, I*d)), (x*(a + b*tan(e))/(c + d*tan(e)), Eq(f, 0)), (2*a*c*f*x/(2*c**2*f + 2*d**2*f) + 2*a*d*log(
c/d + tan(e + f*x))/(2*c**2*f + 2*d**2*f) - a*d*log(tan(e + f*x)**2 + 1)/(2*c**2*f + 2*d**2*f) - 2*b*c*log(c/d
 + tan(e + f*x))/(2*c**2*f + 2*d**2*f) + b*c*log(tan(e + f*x)**2 + 1)/(2*c**2*f + 2*d**2*f) + 2*b*d*f*x/(2*c**
2*f + 2*d**2*f), True))

________________________________________________________________________________________

Giac [A]  time = 1.36907, size = 131, normalized size = 2.22 \begin{align*} \frac{\frac{2 \,{\left (a c + b d\right )}{\left (f x + e\right )}}{c^{2} + d^{2}} + \frac{{\left (b c - a d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}} - \frac{2 \,{\left (b c d - a d^{2}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{2} d + d^{3}}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))/(c+d*tan(f*x+e)),x, algorithm="giac")

[Out]

1/2*(2*(a*c + b*d)*(f*x + e)/(c^2 + d^2) + (b*c - a*d)*log(tan(f*x + e)^2 + 1)/(c^2 + d^2) - 2*(b*c*d - a*d^2)
*log(abs(d*tan(f*x + e) + c))/(c^2*d + d^3))/f